package mylogin

import "github.com/gin-gonic/gin"

func MyHandler(c *gin.Context) {
	c.JSON(200, gin.H{
		"hello": "世界，你好。",
	})
}


func Login(c *gin.Context) {
	c.HTML(200, "login.html", nil)

}

func Dologin(c *gin.Context) {
	username := c.PostForm("username")
	password := c.PostForm("password")
	c.HTML(200, "index.html", gin.H{
		"username": username,
		"password": password,
	})
}

func WithLogin() {
	e := gin.Default()
	e.LoadHTMLGlob("mylogin/*")
	e.GET("/login", Login)
	e.POST("/login", Dologin)
	e.Run(":9999")
}
